package com.fish.design.create.singleton.hungry;

/**
 * @PACKAGE_NAME: com.fish.design.create.singleton.hungry
 * @Author: wangyingbin
 * @Date: 2021/11/25 19:07
 * @Description: 饿汉式单例
 */

public class HungrySingleton {

    private HungrySingleton(){}
    // 写法一
    private static final HungrySingleton INSTANCE = new HungrySingleton();
    // 写法二
    /*private static final HungrySingleton INSTANCE;
    static {
        INSTANCE = new HungrySingleton();
    }*/
    public static HungrySingleton getInstance() {
        return INSTANCE;
    }
}
